<template>
    	<div class="rank-info-content">
		<div class="rank-banner-wrap" :style="{backgroundImage:'url('+ imgurl + ')'}">
			<div class="rank-status container">
				<p>上次更新时间：{{getToday()}}</p>
			</div>
		</div>
		
		<div class="rank-info-list">
			<mt-cell v-for="(item,index) in songList" :title="item.filename" @click.native="playAudio(index)" :key="index">
				<span class="rank-index" :class="{'rank-list-good' : index<3, 'rank-list-first' : index==0, 'rank-list-second' : index==1, 'rank-list-third' : index==2}">{{index+1}}</span>
				<img src="../assets/images/download_icon.png" width="20" height="20">
			</mt-cell>
		</div>
	</div>
</template>
<script>
import {getphSonglist} from "@/api"
import { Indicator } from 'mint-ui'
import { PLAY_AUDIO} from '@/mixins'
export default{
    mixins:[PLAY_AUDIO],
    data(){
        return {
            imgurl:"",
            songList:[],
            updateTime:"",
        }
    },
    created(){
        this.getlist()
    },
    methods:{
        getlist(){
            var rankid=this.$route.params.rankid
            console.log(this.$route.params)
            	Indicator.open({
					text: '加载中...',
					spinnerType: 'snake'
				})
            getphSonglist(rankid).then(({data})=>{
                console.log(data)
                Indicator.close()
                this.imgurl=data.info.banner7url.replace("{size}","400")
                this.songList=data.songs.list  
            })
        },
        getToday(){
            const time=new Date()
            const year=time.getFullYear()
            let month=time.getMonth()+1
            let data=time.getDate()
            if(month<10) month='0'+month
            if(data<10) data='0'+data
            return `${year}-${month}-${data}`
        }
    }
}
</script>
